package com.xbao.service.impl;

import com.xbao.enums.CheckTypeEnum;
import com.xbao.enums.ClsStatusEnum;
import com.xbao.enums.ClsTypeEnum;
import com.xbao.enums.StuTypeEnum;
import com.xbao.service.GlobalService;
import org.springframework.stereotype.Service;

import java.util.HashMap;

/**
 */
@Service
public class GlobalServiceImpl implements GlobalService {

    public HashMap<String, HashMap<String, String>> buildGlobalConfigs() {
        HashMap<String, HashMap<String, String>> vs = new HashMap<String, HashMap<String, String>>();
        vs.put("stutypes", getStuTypes());
        vs.put("clstypes", getClsTypes());
        vs.put("clsstatus", getClsStatus());
        vs.put("checktypes", getCheckTypes());
        return vs;
    }


    public HashMap<String, String> getStuTypes() {
        HashMap<String, String> values = new HashMap<>();
        for (StuTypeEnum e : StuTypeEnum.values()) {
            values.put(e.code, e.desc);
        }
        return values;
    }

    public HashMap<String, String> getClsTypes() {
        HashMap<String, String> values = new HashMap<>();
        for (ClsTypeEnum e : ClsTypeEnum.values()) {
            values.put(e.code, e.desc);
        }
        return values;
    }

    public HashMap<String, String> getCheckTypes() {
        HashMap<String, String> values = new HashMap<>();
        for (CheckTypeEnum e : CheckTypeEnum.values()) {
            values.put(e.code, e.desc);
        }
        return values;
    }

    public HashMap<String, String> getClsStatus() {
        HashMap<String, String> values = new HashMap<>();
        for (ClsStatusEnum e : ClsStatusEnum.values()) {
            values.put(e.code, e.desc);
        }
        return values;
    }


}
